//
//  UIView+RLLayer.h
//  RealmeLink
//
//  Created by lkx on 2020/8/16.
//  Copyright © 2020 chewyong. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (RLLayer)

/// 设置圆角
- (void)rlSetCorner:(CGFloat)radius;

/// 设置带边框的圆角
/// @param width 边框大小
/// @param backgroundColor 背景颜色
/// @param borerColor 边框颜色
/// @param radius 边框圆角大小
- (void)setBorderWidth:(CGFloat)width
       backgroundColor:(UIColor *)backgroundColor
           borderColor:(UIColor * __nullable)borerColor
                corner:(CGFloat)radius;

/// 边框的圆角的shapeLayer
/// @param width 边框大小
/// @param backgroundColor 背景颜色
/// @param borderColor 边框颜色
/// @param radius 边框圆角大小
- (CAShapeLayer *)rlsb_setBorderWidth:(CGFloat)width
                      backgroundColor:(UIColor *)backgroundColor
                          borderColor:(UIColor * __nullable)borderColor
                               corner:(CGFloat)radius;

/// 边框的圆角的shapeLayer
/// @param width 边框大小
/// @param backgroundColor 背景颜色
/// @param rect 边框位置
/// @param borderColor 边框颜色
/// @param radius 边框圆角大小
- (CAShapeLayer *)rlsb_setBorderWidth:(CGFloat)width
                                 rect:(CGRect)rect
                      backgroundColor:(UIColor *)backgroundColor
                          borderColor:(UIColor * __nullable)borderColor
                               corner:(CGFloat)radius;

/// 设置带边框的圆角
/// @param backgroundColor 背景颜色
/// @param radius 边框圆角大小
- (CAShapeLayer *)setBackgroundColor:(UIColor *)backgroundColor
                              corner:(CGFloat)radius;

/// 设置圆角
/// @param backgroundColor 背景颜色
/// @param rect 圆角位置
/// @param radius 边框圆角大小
- (CAShapeLayer *)setBackgroundColor:(UIColor *)backgroundColor
                                rect:(CGRect)rect
                              corner:(CGFloat)radius;

/// 设置圆角
/// @param backgroundColor 背景颜色
/// @param corners 圆角定义
/// @param radius 边框圆角大小
- (CAShapeLayer *)rl_setBackgroundColor:(UIColor *)backgroundColor
                   byRoundingCorners:(UIRectCorner)corners
                              corner:(CGFloat)radius;

/// 设置圆角阴影
/// @param backgroundColor 背景颜色
/// @param corners 圆角定义
/// @param radius 边框圆角大小
/// @param shadowColor 阴影颜色
/// @param shadowOffset 阴影便宜
/// @param shadowOpacity 阴影透明度
- (CAShapeLayer *)rl_setBackgroundColor:(UIColor *)backgroundColor
                      byRoundingCorners:(UIRectCorner)corners
                                 corner:(CGFloat)radius
                            shadowColor:(UIColor *)shadowColor
                           shadowOffset:(CGSize)shadowOffset
                          shadowOpacity:(CGFloat)shadowOpacity;

/// 设置带边框的圆角
/// @param progress 进度
/// @param progressColor 进度颜色
/// @param radius 边框圆角大小
- (CAShapeLayer *)setProgress:(CGFloat)progress
                progressColor:(UIColor *)progressColor
                       corner:(CGFloat)radius;

- (CAShapeLayer *)lkx_borderOfDottedLine:(CGFloat)lineLength
                               lineSpace:(CGFloat)lineSpace
                             borderWidth:(CGFloat)borderWidth
                             borderColor:(UIColor *)borderColor
                         backgroundColor:(UIColor *)backgroundColor
                            cornerRadius:(CGFloat)radius;

/// 设置虚线
/// @param lineLength 虚线长度
/// @param lineSpace 虚线间隔
/// @param borderWidth 虚线宽度
/// @param borderColor 边框颜色
/// @param backgroundColor 背景图标
/// @param radius 圆角
- (void)lkx_setBorderOfDottedLine:(CGFloat)lineLength
                        lineSpace:(CGFloat)lineSpace
                      borderWidth:(CGFloat)borderWidth
                      borderColor:(UIColor *)borderColor
                  backgroundColor:(UIColor *)backgroundColor
                     cornerRadius:(CGFloat)radius;

/// 获取渐变背景色
- (CAGradientLayer *)lkx_gradientBackgroundColor:(NSArray<UIColor *> *)colors;

/// 设置渐变背景色
- (CAGradientLayer*)lkx_setGradientBackgroundColor:(NSArray<UIColor *> *)colors;

@end

NS_ASSUME_NONNULL_END
